home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 21
/
Cream of the Crop 21 (Terry Blount) (October 1996).iso
/
program
/
slix0987.zip
/
GMUTILS.ZIP
/
BOXCRS.DOC
< prev
next >
Wrap
Text File
|
1995-06-22
|
10KB
|
195 lines
BOXCR - Box Creator
BOXCRT - Box Creator, Tweaked
Documentation
by Petri Hassinen
Contact via Internet:
phassine@alpha.hut.fi
PURPOSE
BOXCR(T) is a useful utility for cutting out tiny portions of
graphics from a larger picture and converting them into a format
that is easily retrievable from memory. BOXCRS can be used to
generate sprites and again to view the data back in its original
visual form.
OPERATION
The two described utilities, BOXCR and BOXCRT are, in fact, almost
similar to each other. The only difference is in the order in which
they scan the original picture data.
The following pictures illustrate the way the original picture is
processed. The grid represents a portion of graphics in a larger
area that is marked with asterisks (*). The numbers indicate the
order in which the pixels are placed into memory. Each number
corresponds to exactly one pixel in the picture.
...***************************************************...
... * * * * * * * * * *...
...*****┌────┬────┬────┬────┬────┬────┬────┐**********...
...* │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ * *...
...*****├────┼────┼────┼────┼────┼────┼────┤**********...
...* │ 8 │ 9 │ 10 │ 11 │ 12 │ 13 │ 14 │ * *...
...*****├────┼────┼────┼────┼────┼────┼────┤**********...
...* │ 15 │ 16 │ 17 │ 18 │ 19 │ 20 │ 21 │ * *...
...*****├────┼────┼────┼────┼────┼────┼────┤**********...
...* │ 22 │ 23 │ 24 │etc.│ │ │ │ * *...
...*****├────┼────┼────┼────┼────┼────┼────┤**********...
...* │ │ │ │ │ │ │ │ * *...
...*****├────┼────┼────┼────┼────┼────┼────┤**********...
...* │ │ │ │ │ │ │ │ * *...
...*****└────┴────┴────┴────┴────┴────┴────┘**********...
...* * * * * * * * * *...
...***************************************************...
BOXCR - Horizontal mode, 7 x 6 sprite
┌────┬────┬────┬────┬────┬────┬────┐
│ 1 │ 7 │ 13 │ 19 │ │ │ │
├────┼────┼────┼────┼────┼────┼────┤
│ 2 │ 8 │ 14 │ 20 │ │ │ │
├────┼────┼────┼────┼────┼────┼────┤
│ 3 │ 9 │ 15 │ 21 │ │ │ │
├────┼────┼────┼────┼────┼────┼────┤
│ 4 │ 10 │ 16 │etc.│ │ │ │
├────┼────┼────┼────┼────┼────┼────┤
│ 5 │ 11 │ 17 │ │ │ │ │
├────┼────┼────┼────┼────┼────┼────┤
│ 6 │ 12 │ 18 │ │ │ │ │
└────┴────┴────┴────┴────┴────┴────┘
BOXCR - Vertical mode, 7 x 6 sprite
┌────┬────┬────┬────┬────┬────┬────┐
│ 1 │ 3 │ 5 │ 7 │ 2 │ 4 │ 6 │
├────┼────┼────┼────┼────┼────┼────┤
│ 8 │ 10 │ 12 │ 14 │ 9 │ 11 │ 13 │
├────┼────┼────┼────┼────┼────┼────┤
│ 15 │ 17 │etc.│ │ │ │ │
├────┼────┼────┼────┼────┼────┼────┤
│ │ │ │ │ │ │ │
├────┼────┼────┼────┼────┼────┼────┤
│ │ │ │ │ │ │ │
├────┼────┼────┼────┼────┼────┼────┤
│ │ │ │ │ │ │ │
└────┴────┴────┴────┴────┴────┴────┘
BOXCRT - Horizontal mode, 7 x 6 sprite
┌────┬────┬────┬────┬────┬────┬────┐
│ 1 │ 13 │ 25 │ 37 │ 7 │ 19 │ 31 │
├────┼────┼────┼────┼────┼────┼────┤
│ 2 │ 14 │ 26 │ 38 │ 8 │ 20 │ 32 │
├────┼────┼────┼────┼────┼────┼────┤
│ 3 │ 15 │ 27 │ 39 │ 9 │ 21 │ 33 │
├────┼────┼────┼────┼────┼────┼────┤
│ 4 │ 16 │ 28 │ 40 │ 10 │ 22 │ 34 │
├────┼────┼────┼────┼────┼────┼────┤
│ 5 │ 17 │ 29 │ 41 │ 11 │ 23 │ 35 │
├────┼────┼────┼────┼────┼────┼────┤
│ 6 │ 18 │ 30 │ 42 │ 12 │ 24 │ 36 │
└────┴────┴────┴────┴────┴────┴────┘
BOXCRT - Vertical mode, 7 x 6 sprite
It is up to you which method, horizontal or vertical, you choose to
use in your routines. For optimized performance, vertical mode can
sometimes be handy.
The order in which the pixels are processed in BOXCRT may seem
strange at first but it is completely equivalent to the way the data
is seen by the hardware. At least this holds true for the tweaked
320x200x256 mode.
BOXCRS "cut" only entire boxes (sprites) from the original picture
file. In other words, if the user specified a value 15 for the box
width BOXCRS would cut only (320/15=21.333) 21 boxes from each
horizontal line. The same rule is also applicable to vertical line.
Furthermore, the user may give the exact number of boxes that he/she
wishes to create. The size of the resulting output file is directly
proportional to the created boxes (xsize*ysize*number).
You can also view the processed file (LBM & RAW) by typing its name
after BOXCR(T). This way you can make sure, that the created boxes
are correct and the original file is decoded correctly. Namely,
BOXCRS do not recognize the full LBM format but the sub format PBM
only. If you have an older LBM file using ILBM format, you can
convert it into PBM format with PPFIX.
For more information, type "BOXCR /?" or "BOXCRT /?" at the DOS
prompt.
EXAMPLES
Suppose that you have a picture file that has the shapes of many
sprites you want to generate (just like EXPLODE.LBM - see it!). You
can use BOXCRS to generate the sprite data, but before that, you
must find out the size of a sprite block.
Let's assume that you want to generate 5 explosion sprites that are
found in EXPLODE.LBM. To do this, type:
BOXCR explode.lbm /57 /46 /5
To later see how the sprite data looks back in its "understandable"
form, type:
BOXCR explode.raw /57 /46 /B
Note! You must remember the box sizes to see the file correctly.
You can facilitate the process of finding the correct box sizes by
using ANIME. Namely, if your original sequence file animates
correctly, you can use the same dimensions with BOXCRS as well. I
found the previous values in this example by looking at the contents
of ADEMO.BAT - sequence number 5 (label :exp).
CRSPR.BAT - What is it?
On the other hand, if you want to create sprites that are found in
several files (one in each file) you cannot efficiently use BOXCRS
for that. This can be relevant if you do not draw your sprites
yourself but render them with e.g. a CAD program.
For situations like these, I have written a batch named CRSPR.BAT.
Run it, and it will tell you how to proceed.
If you necessarily want to save disk space (concerns temporary *.TRN
files), you can modify the batch so that it accepts 'ending_address'
as well (see help first by typing CRSPR). Namely, the current
versi